﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace WinForm1
{
    public partial class RegisterForm : Form
    {
        public RegisterForm()
        {
            InitializeComponent();
        }


        //确认
        private void button1_Click(object sender, EventArgs e)
        {
            var uid = txtName.Text;

            var pwd = txtPassWord.Text;

            var rePwd = txtRePassWord.Text;

            var hasUid = !string.IsNullOrEmpty(uid);

            var hasPwd = !string.IsNullOrEmpty(pwd);

            var eqPwd = pwd == rePwd;

            if (hasUid && hasPwd && eqPwd)
            {
                var sql = string.Format("insert into Users (Username , Password) values ('{0}',{1})",uid,pwd);

                var res = DBHelper.GetDataTable(sql);

                MessageBox.Show("注册成功","提示");

                this.Close();

            }
            else
            {
                MessageBox.Show("注册失败","提示");
            }


        }


        //取消
        private void button3_Click(object sender, EventArgs e)
        {
            this.Close();
        }
    }
}
